﻿using System;
using System.Net;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Documents;
using System.Windows.Ink;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Animation;
using System.Windows.Shapes;
using AdminModule.CommonClasses;
using System.Runtime.Serialization;

namespace AdminModule.IndexMarkServiceReference
{
    public partial class AdmDepartment
    {
        public AdmDepartment() : base() 
        {
            this.PropertyChanged += new System.ComponentModel.PropertyChangedEventHandler(AdmDepartment_PropertyChanged);
        }

        [OnDeserializedAttribute]
        public void InitAdmDepartment(StreamingContext context)
        {
            this.PropertyChanged += new System.ComponentModel.PropertyChangedEventHandler(AdmDepartment_PropertyChanged);
        }

        void AdmDepartment_PropertyChanged(object sender, System.ComponentModel.PropertyChangedEventArgs e)
        {
            if (e.PropertyName == "Name") this.RaisePropertyChanged("FullName");
        }

        public override int GetKey()
        {
            return (this.IDDepartment ?? 0);
        }

        public override Type GetObjType()
        {
            return this.GetType();
        }

        public override void CopyFrom(DTOBase copyFrom)
        {
            AdmDepartment d = copyFrom as AdmDepartment;

            this.IDDepartment = d.IDDepartment;
            this.DepartmentType = d.DepartmentType;
            this.Name = d.Name;
            this.Abbriviation = d.Abbriviation;
        }

        public string SIDForEdit
        {
            get
            {
                return this.SID;
            }
            set
            {
                if (string.IsNullOrEmpty(value.Trim()))
                    this.SID = null;
                else
                    this.SID = value;
            }
        }

        private string sidToName = string.Empty;

        public string SIDToName
        {
            get
            {
                return sidToName;
            }
            set
            {
                sidToName = value;
                RaisePropertyChanged("SIDToName");
            }
        }
    }
}
